package cn.edu.hnnu.c.rentacar.dao.text;

import cn.edu.hnnu.c.rentacar.beans.Car;
import cn.edu.hnnu.c.rentacar.beans.CheckRecord;
import cn.edu.hnnu.c.rentacar.beans.Customer;
import cn.edu.hnnu.c.rentacar.beans.RentRecord;
import cn.edu.hnnu.c.rentacar.beans.User;
import cn.edu.hnnu.c.rentacar.dao.hibernateimpl.CarDAOHibernateImpl;
import cn.edu.hnnu.c.rentacar.dao.hibernateimpl.CheckRecordDAOHibernateImpl;
import cn.edu.hnnu.c.rentacar.dao.hibernateimpl.CustomerDAOHibernateImpl;
import cn.edu.hnnu.c.rentacar.dao.hibernateimpl.RentRecordDAOHibernateImpl;
import cn.edu.hnnu.c.rentacar.dao.hibernateimpl.UserDAOHibernateImpl;
import cn.edu.hnnu.c.rentacar.idao.ICarDAO;
import cn.edu.hnnu.c.rentacar.idao.ICheckRecordDAO;
import cn.edu.hnnu.c.rentacar.idao.ICustomerDAO;
import cn.edu.hnnu.c.rentacar.idao.IRentRecordDAO;
import cn.edu.hnnu.c.rentacar.idao.IUserDAO;

public class TextHibernateDAO {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		
		addUser(new User());

		
	}
	
	/**
	 * 创建用户表
	 * @param user
	 */
	public static void addUser(User user){
		IUserDAO dao = UserDAOHibernateImpl.getInstance();
		dao.addUser(user);
//		addCar(new Car());
//		addCustomer(new Customer());
//		addRentRecord(new RentRecord());
//		addCheckRecord(new CheckRecord());
	}
	
	/**
	 * 创建客户表
	 * @param customer
	 */
	public static void addCustomer(Customer customer){
		ICustomerDAO dao = CustomerDAOHibernateImpl.getInstance();
		dao.addCustomer(customer);
	}
	
	/**
	 * 创建车辆表
	 * @param car
	 */
	public static void addCar(Car car){
		ICarDAO dao = CarDAOHibernateImpl.getInstance();
		dao.addCar(car);
	}
	
	/**
	 * 创建租车表
	 * @param rentRecord
	 */
	public static void addRentRecord(RentRecord rentRecord){
		IRentRecordDAO dao = RentRecordDAOHibernateImpl.getInstace();
		dao.addRentRecord(rentRecord);
	}
	
	/**
	 * 创建检查表
	 * @param checkRecord
	 */
	public static void addCheckRecord(CheckRecord checkRecord){
		ICheckRecordDAO dao = CheckRecordDAOHibernateImpl.getInstance();
		dao.addCheckRecord(checkRecord);
	}

}
